<template>
  <el-empty v-if="growthStageData.collectionDate==null" description="暂无生长状况记录"/>
  <el-descriptions
      v-else
      border
      :column="2"
      size="large"
  >
    <el-descriptions-item label="填写日期" width="300px">{{ growthStageData.collectionDate }}</el-descriptions-item>
    <el-descriptions-item label="生长周期时长" width="300px">{{ growthStageData.growthCycle }}&nbsp;天</el-descriptions-item>
    <el-descriptions-item label="平均光照强度水平">{{ scoreValue[growthStageData.lightDuration] }}</el-descriptions-item>
    <el-descriptions-item label="环境平均温度">{{ parseFloat(growthStageData.temperature).toFixed(1) }}&nbsp;℃</el-descriptions-item>
    <el-descriptions-item label="生长土壤酸碱度">{{ PHValue[growthStageData.soilPH] }}</el-descriptions-item>
    <el-descriptions-item label="农药喷洒水平">{{ pesticideDoseValue[growthStageData.pesticideDose] }}</el-descriptions-item>
    <el-descriptions-item label="生长阶段补充描述">{{ growthStageData.otherDescription }}</el-descriptions-item>
  </el-descriptions>
</template>

<script>
import request from "@/http/request";

export default {
  name: "GrowthData",
  props: {
    uuid: {
      type: String,
      default: "",
    },
    growthStage: {
      type: String,
      default: "-1",
    },
  },
  data() {
    return {
      growthStageData: {},
    }
  },
  methods: {
    getGrowthRecordInfo() {
      const _this = this;
      if (_this.uuid && _this.growthStage) {
        request({
          "url": "produce/getProduceGrowUp",
          "method": "post",
          data: {
            uuid: this.uuid,
            GrowUp: this.growthStage,
          }
        }).then( (response)=> {
          if (response.code === 200) {
            this.growthStageData = response.data;
          }
        })
      }
    },
  },
  setup() {
    const scoreValue = ['','优秀', '良好', '一般', '不足'];
    const PHValue = ['','碱性', '弱碱性','中性','弱酸性','酸性'];
    const pesticideDoseValue = ['','无农药喷洒', '低于正常值', '正常值', '高于正常值'];
    return {
      scoreValue,
      PHValue,
      pesticideDoseValue,
    }
  },
  mounted() {
    this.getGrowthRecordInfo();
  }
}
</script>

<style scoped>

</style>